import request from '../request/request'

// 搜索
export const indexSearch = (value, type, limit=30) => {
    return request({
        method: 'get',
        url: `/search?keywords=${value}&type=${type}&limit=${limit}`,
    })
}

// 查询音乐是否可用
export const indexCheckMusic = (value) => {
    return request({
        method: 'get',
        url: `/check/music?id=${value}`,
    })
}

// 查询歌曲详情
export const indexGetSong = (id) => {
    return request({
        method: 'get',
        url: `/song/detail?ids=${id}`,
    })
}

// 查询歌词
export const indexGetLyric = (id) => {
    return request({
        method: 'get',
        url: `/lyric?id=${id}`,
    })
}

// 获取相似歌曲
export const indexLikeSong = (id) => {
    return request({
        method: 'get',
        url: `/simi/song?id=${id}`
    })
}


/**
 * 获取音乐链接
 * /song/url/v1?id=33894312&level=exhigh
 * 必选参数 : id : 音乐 id 
 * level: 播放音质等级, 
 *  分为 standard => 标准,
 *  higher => 较高,
 *  exhigh=>极高,
 *  lossless=>无损,
 *  hires=>Hi-Res
 */

export const indexMusicUrl = (id, level) => {
    return request({
        method: 'get',
        url: `/song/url/v1?id=${id}&level=${level}`
    })
}


